package com.gm.blog.controller;

import com.gm.blog.exception.BlogException;
import com.gm.blog.utils.Result;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 */
@RestController
@RequestMapping("/test")
public class TestController {
    /**
     * 测试异常
     * @return
     */
    @RequestMapping(value="/testException/{id}",method = RequestMethod.GET)
    public Result<Object> testException(@PathVariable Integer id){
        if(id==1){
            return new Result<>();
        }else{
            throw new BlogException("发生了异常");
        }

    }
}
